package com.hyl.controller;

import com.hyl.pojo.Message;
import com.hyl.pojo.ResMessage;
import org.springframework.messaging.handler.annotation.MessageMapping;
import org.springframework.messaging.handler.annotation.SendTo;
import org.springframework.stereotype.Controller;

/**
 * 消息推送控制器
 *
 * @author HYL
 * @create 2017-06-07 上午10:53
 **/
@Controller
public class MessageController {

    @MessageMapping("/welcome")
    @SendTo("/topic/getResponse")
    public ResMessage push(Message resMessage)throws  Exception{
//        Thread.sleep(2000);
        ResMessage resMessage1 = new ResMessage();
        resMessage1.setResMessage("welcome"+resMessage.getMessage()+"!");
        return resMessage1;
    }
}
